<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;


class BlogTypes extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('types', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name',100)->index('name')->comment('栏目名称');
            $table->string('keywords',250)->comment('栏目关键字');
            $table->string('description',250)->comment('栏目描述');
            $table->integer('parent_id')->unsigned()->default('0')->comment('父级栏目ID');
            $table->string('path')->default('0')->comment('栏目路径');
            $table->string('img')->nullable($value = true)->comment('栏目图片');
            $table->text('content')->nullable($value = true)->comment('栏目内容');
            $table->integer('weight')->unsigned()->nullable($value = true)->default('0')->comment('排序');
            $table->unsignedTinyInteger('is_show')->default('1')->comment('1:显示;2隐藏;');
            $table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
            $table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP'));
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('types');
    }
}
